package com.touch.workshop.ui.scripteditor;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
public class ScriptEditor extends JInternalFrame
{	 
	private static final long serialVersionUID = -1505747247224604930L;
	protected JScrollPane treeScroll;
    protected JScrollPane textScroll;
    protected JTree treeBlocks;
    protected JTextArea text;
    protected ScriptEditorMenuBar menubar;
    protected DefaultMutableTreeNode root = new DefaultMutableTreeNode("Scripts");
    
	private void initComponents() 
    {
		this.treeScroll = new JScrollPane();
		this.treeBlocks = new JTree(root);
		this.textScroll = new JScrollPane();
		this.text = new JTextArea();
		
		this.menubar = new ScriptEditorMenuBar();
        		
        this.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);

        this.treeScroll.setViewportView(treeBlocks);    
        this.textScroll.setViewportView(text);

        this.setJMenuBar(menubar);

        final GroupLayout layout = new GroupLayout(this.getContentPane());        
        
        this.getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(treeScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(textScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 417, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(treeScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
            .addComponent(textScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
        );
        pack();
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() 
            {
            	ScriptEditorControls.SCRIPT_EDITOR.setVisible(true);
            }
        });
    }
    
	public ScriptEditor()
	{
		super("Script Editor", true, true, true, true);
		initComponents();
		//this.text.getDocument().addDocumentListener(ScriptHandlers.Script_Text_Handler);		
	}
}
